# include <stdio.h>
# include <conio.h>
# include <math.h>

void main()
{
  double e,b[3],x[3],x0[3],a[3][3],maxd;
  int i,j;
  printf("e=");
  scanf("%lg",&e);
  for (i=0;i<=2; i++)
    {
      for (j=0;j<=2;j++)
	{
	  printf("a[%d,%d]=",i,j);
	  scanf("%lg",&a[i][j]);
	};
	printf("b[%d]=",i);
	scanf("%lg",&b[i]);
	x[i]=x0[i]=b[i];
    };
  do
  {
    for(i=0;i<=2;i++)
      x0[i]=x[i];
    x[0]=(b[0]-x[1]*a[0][1]-x[2]*a[0][2])/a[0][0];
    x[1]=(b[1]-x[0]*a[1][0]-x[2]*a[1][2])/a[1][1];
    x[2]=(b[2]-x[0]*a[2][0]-x[1]*a[2][1])/a[2][2];
    maxd=fabs(x[0]-x0[0]);
    for(i=1;i<=2;i++)
      if (maxd<fabs(x[i]-x0[i])) maxd=fabs(x[i]-x0[i]);
  }
  while(maxd>e);
  for(i=0;i<=2;i++)
  printf("\n x[%d]=%g",i,x[i]);

  getch();
};
